'use strict';

import { Application } from 'egg'

const apiSuperAuthHeader = '/super-auth/enum'
const apiAuthHeader = '/auth/enum'

const getSuperAuthApi = (path: string) => {
  return `${apiSuperAuthHeader}/${path}`
}

const getAuthApi = (path: string) => {
  return `${apiAuthHeader}/${path}`
}

export default (app: Application) => {
  const { router, controller } = app;
  router.post(getSuperAuthApi('update/:id'), controller.enum.update);
  router.post(apiSuperAuthHeader, controller.enum.create);
  // 更新数据说明
  router.post(getSuperAuthApi('update/data-show/:id'), controller.enum.updateDataShow);
  router.delete(getSuperAuthApi(':id'), controller.enum.delete);
  // 获取 enum 详情数据
  router.get(getAuthApi(':id'), controller.enum.show);
};
